package cn.chrisx.drad.audiencenetwork;

import com.facebook.ads.Ad;
import com.facebook.ads.AdError;
import com.facebook.ads.AdListener;

import cn.chrisx.drad.core.DrAdError;
import cn.chrisx.drad.core.DrAdPlatform;
import cn.chrisx.drad.platform.BasePlatformAd;

/**
 * @author Jzfox <jz_boy@163.com>
 * @version 1.0
 * @date 2018/9/26 9:27
 * @description
 * @copyright ©2018 www.jzfox.net All rights reserved.
 */
abstract class BaseAd extends BasePlatformAd implements AdListener {


    @Override
    public void onError(Ad ad, AdError adError) {
        onAdLoadFailed(DrAdError.ERROR_THIRD, new DrAdError(AudienceNetworkPlatform.instance().name(), adError.getErrorCode(), adError.getErrorMessage()));
    }

    @Override
    public void onAdLoaded(Ad ad) {
        onAdLoadSuccess();
    }

    @Override
    public void onAdClicked(Ad ad) {
        onAdClicked();
    }

    @Override
    public void onLoggingImpression(Ad ad) {

    }



    @Override
    public DrAdPlatform platform() {
        return AudienceNetworkPlatform.instance();
    }
}
